3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
An application-defined attribute or element type may support any of four copying methods. The reason for defining four different methods is to let you customize the semantics of your Q3AttributeSet_Add and Q3AttributeSet_Get calls to allow for various meanings of the data parameter.
The TQ3XElementCopyAddMethod functionality is optional. If included, it supports adding a new attribute or element type to an attribute set. If it is not included, the default action is a memory copy of sizeOfElement bytes.
#define kQ3XMethodTypeElementCopyAdd Q3_METHOD_TYPE('e','c','p','a')
typedef TQ3Status (*TQ3XElementCopyAddMethod)(
const void *fromAPIElement,
void *toInternalElement);
The TQ3XElementCopyAddMethod method is called when adding a new attribute type to an attribute set, using Q3AttributeSet_Add . The application-defined object is passed whatever pointer was passed in the Q3AttributeSet_Add call as the fromAPIElement parameter, and in toInternalElement a pointer to an empty, uninitialized block of size sizeOfElement (obtained from the registration call).
The TQ3XElementCopyReplaceMethod functionality is optional. If included, it supports replacing an existing attribute or element type. If it is not included, the default action is a memory copy of sizeOfElement bytes.
#define kQ3XMethodTypeElementCopyReplace Q3_METHOD_TYPE('e','c','p','r')
typedef TQ3Status (*TQ3XElementCopyReplaceMethod)(
const void *fromAPIElement,
void *ontoInternalElement);
The TQ3XElementCopyReplaceMethod method is called when replacing an existing attribute type in an attribute set, using Q3AttributeSet_Add .The application-defined object is passed whatever pointer was passed in the Q3AttributeSet_Add call as the fromAPIElement parameter, and in ontoInternalElement a pointer to an existing block of size sizeOfElement (obtained from the registration call) that has previously been initialized with a CopyAdd call.
The TQ3XElementCopyGetMethod functionality is optional. If included, it supports fetching an attribute or element from an attribute set. If it is not included, the default action is a memory copy of sizeOfElement bytes.
#define kQ3XMethodTypeElementCopyGet Q3_METHOD_TYPE('e','c','p','g')
typedef TQ3Status (*TQ3XElementCopyGetMethod)(
const void *fromInternalElement,
void *toAPIElement);
The TQ3XElementCopyGetMethod method is called when obtaining an attribute from an attribute set by means of Q3AttributeSet_Get . The application-defined object is passed in fromInternalElement a pointer to an existing block of size sizeOfElement (determined by the registration call) that has been initialized with a CopyAdd call. It is passed in toAPIElement whatever pointer was passed in the Q3AttributeSet_Get call.
The TQ3XElementCopyDuplicateMethod functionality is optional. If included, it supports internal duplication of attributes or elements. If it is not included, the default action is a memory copy of sizeOfElement bytes.
#define kQ3XMethodTypeElementCopyDuplicate Q3_METHOD_TYPE('e','c','p','d')
typedef TQ3Status (*TQ3XElementCopyDuplicateMethod)(
const void *fromInternalElement,
void *toInternalElement);
The TQ3XElementCopyDuplicateMethod method is called when Q3Object_Duplicate is called for an attribute set or element set. It copies data from a valid block of size sizeOfElement (determined by the registration call) to another block of size sizeOfElement . The block copied into must be invalid.
Previous | QD3D Book | Overview | Chapter Contents | Next |